#ifndef __MyTask_H__
#define __MyTask_H__

#include <memory>
#include <cppjieba/Jieba.hpp>
#include <utfcpp/utf8.h>
#include "TcpServer.h"
#include "MyThread.h"

class KeyRecommandTask;
class WebPageSearchTask;
class ErrorTask;

class MyTask
{
public:
    using MyTaskPtr = shared_ptr<MyTask>;
    static MyTaskPtr createKeyRecommandTask(const std::string &msg, const TcpConnectionPtr &con);
    
    static MyTaskPtr createWebPageSearchTask(const std::string &msg, const TcpConnectionPtr &con);

    static MyTaskPtr createErrorTask(const std::string &msg, const TcpConnectionPtr &con);

    virtual void process(MyThread*) = 0;

    virtual ~MyTask() = default;

protected:
    cppjieba::Jieba m_tokenizer;
};

using MyTaskPtr = shared_ptr<MyTask>;

#endif

